package com.jfinal.weixin.demo.youjia;

/**
 * Created by wangxiaoyang on 16/8/28.
 */
public class YoujiaBean {

    public String showapi_res_code = "";
    public String showapi_res_error = "";
    public Body showapi_res_body ;

    public String format() {
        if( null == showapi_res_body ) {
            return "今日油价查询失败";
        }
        if( null == showapi_res_body.list || showapi_res_body.list.length == 0  ) {
            return "今日油价查询失败";
        }
        StringBuffer youjia = new StringBuffer();
        BodyItem item = showapi_res_body.list[0];
        youjia.append( item.prov );
        youjia.append(" 今日油价为:\n");
        youjia.append("柴油 ");
        youjia.append(item.p0);
        youjia.append(" 元\n");
        youjia.append("90号汽油 ");
        youjia.append(item.p90);
        youjia.append(" 元\n");
        youjia.append("93号汽油 ");
        youjia.append(item.p93);
        youjia.append(" 元\n");
        youjia.append("97号汽油 ");
        youjia.append(item.p97);
        youjia.append(" 元\n");
        return youjia.toString();
    }


    public static class Body {
        public String ret_code = "";

        public BodyItem[] list;
    }

    public static class BodyItem {
        public String p0 = "";
        public String p90 = "";
        public String p93 = "";
        public String p97 = "";
        public String prov = "";

    }
}
